<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="UTF-8">
    <title>成功上传</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }
        .container {
            background: white;
            padding: 2em;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 500px;
            text-align: center;
            transition: transform 0.3s ease-in-out;
        }
        h1 {
            margin-bottom: 1em;
            color: #333;
            font-size: 1.5rem;
        }
        ul {
            list-style-type: none;
            padding: 0;
        }
        li {
            background: #eef6ff;
            margin: 0.5em 0;
            padding: 0.75em 1.5em;
            border-radius: 5px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: background-color 0.3s, transform 0.3s;
            cursor: pointer;
        }
        li:hover {
            background-color: #dcecff;
            transform: scale(1.02);
        }
        li span {
            flex-grow: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        a.download-btn {
            text-decoration: none;
            color: white;
            background-color: #007bff;
            padding: 0.5em 1em;
            border-radius: 5px;
            transition: background-color 0.3s, transform 0.3s;
            display: inline-flex;
            align-items: center;
        }
        a.download-btn i {
            margin-right: 0.5em;
        }
        a.download-btn:hover {
            background-color: #0056b3;
            transform: translateY(-2px);
        }
        p {
            margin-top: 1em;
            color: #6c757d;
            font-size: 0.9rem;
        }
        .no-files {
            color: #dc3545;
            font-weight: bold;
            font-size: 1.1rem;
        }
        /* 响应式设计 */
        @media (max-width: 600px) {
            h1 {
                font-size: 1.2rem;
            }
            li {
                padding: 0.75em 1em;
            }
            a.download-btn {
                font-size: 0.8rem;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <h1 th:text="${message}">默认文本</h1>
    <ul>
        <!-- 使用Thymeleaf表达式语言来迭代文件列表 -->
        <li th:each="file : ${fileList}">
            <span th:text="${file}">File Name</span>
            <a th:href="@{/downloadFile(filename=${file})}" class="download-btn">
                <i class="fas fa-download"></i>下载
            </a>
        </li>
    </ul>

    <!-- 如果需要显示没有文件的信息 -->
    <p th:if="${#lists.isEmpty(fileList)}" class="no-files">当前目录下没有文件。</p>
</div>
</body>
</html>